home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / prog / regkey30.arj / QB.ARJ / REGKEYQB.BI < prev    next >
Text File  |  1994-03-07  |  7KB  |  174 lines

  1. '
  2. '
  3. '
  4. '
  5. '
  6. '
  7. '                                                                   R E G K E Y
  8. '
  9. '------------------------------------------------------------------------------
  10. '
  11. '
  12. '                                                                  Version 3.00
  13. '
  14. '
  15. '                                   The Registration Key System For Programmers
  16. '
  17. '
  18. '                                                       QuickBASIC Include File
  19. '
  20. '
  21. '
  22. '
  23. '         (C) Copyright Brian Pirie, 1993 - 1994. All Rights Reserved.
  24. '
  25. '
  26.  
  27.  
  28.  
  29. ' FUNCTION RETURN VALUES
  30. ' ----------------------
  31.  
  32. CONST RKFailure = 0
  33. CONST RKSuccess = 1
  34.  
  35.  
  36.  
  37. ' REGISTRATION KEY VALIDATION RESULTS
  38. ' -----------------------------------
  39.  
  40. CONST RKUnregistered = 0
  41. CONST RKRegistered = 1
  42.  
  43.  
  44.  
  45. ' FUNCTION DECLARATIONS
  46. ' ---------------------
  47.  
  48. ' RegKeyNewCodeSet()
  49. '
  50. ' Generates a registration key validation code corresponding to a
  51. ' generation code. This set of generation and validation codes is unique
  52. ' for each application using RegKey, and determines the unique registration
  53. ' key that corresponds to a particular user's name. The secret generation
  54. ' code is used at registration key generation time, and the corresponding
  55. ' validation code is used within your application when validating a
  56. ' registration key. The validation and generation codes are each
  57. ' represented as a ten-digit strings of numbers and upper-case letters.
  58. '
  59. ' This function is called by KeyGen or your own utility, and is only used
  60. ' once for each application using RegKey.
  61. '
  62. ' sGenerationCode     INPUT: Ten digit generation code
  63. ' sValidateCode       OUTPUT: Ten digit validation code
  64.  
  65. DECLARE FUNCTION RegKeyNewCodeSet%(sGenerationCode$, sValidationCode$)
  66.  
  67.  
  68.  
  69. ' RegKeyGenerate()
  70. '
  71. ' Generates a registration key for a particular user, using the secret
  72. ' generation code corresponding to a particular application (as passed to
  73. ' RegKeyNewCodeSet()). The registration string is usually the name of the
  74. ' registered user, but may also contain other information, such as the
  75. ' version registered or date of expiry. The registration key is returned as a
  76. ' string of letters and upper-case numbers. sRegKey must be large enough to
  77. ' hold 20 digits. sRandomSeed should contain 10 random numbers and upper-case
  78. ' letters, which are required during the registration key generation process.
  79. '
  80. ' This function is called by KeyGen or your own registration key generation
  81. ' utility, each time a registration key is generated for a new user. This
  82. ' function is used for user-entered registration keys; compare with
  83. ' RegKeyFileGenerate().
  84. '
  85. ' sRegString          INPUT: Registration string
  86. ' sGenerationCode     INPUT: App's generation code
  87. ' sRandomSeed         INPUT: Random number seed
  88. ' sRegKey             OUTPUT: 20-digit registration key
  89.  
  90. DECLARE FUNCTION RegKeyGenerate%(sRegString$, sGenerationCode$, sRandomSeed$, sRegKey$)
  91.  
  92.  
  93.  
  94. ' RegKeyValidate()
  95. '
  96. ' Checks whether a given registration string and registration key
  97. ' combination is valid for a particular application, using the application-
  98. ' specific validation code that was generated by RegKeyNewCodeSet(). The
  99. ' RKVALID pointed to by peRegistered is set to either RK_REGISTERED or
  100. ' RK_UNREGISTERED, indicating whether or not the registration key and
  101. ' registration string are valid. If you have registered RegKey, your own
  102. ' name and RegKey registration key should be passed to this function to
  103. ' disable the RegKey "unregistered" message.
  104. '
  105. ' This function is called from within your application each time it
  106. ' executes, in order to determine whether it should operate in registered
  107. ' or unregistered mode. This function is used with user-entered
  108. ' registration keys; compare with RegKeyFileValidate().
  109. '
  110. ' sRegString          INPUT: Registration string
  111. ' sRegKey             INPUT: 20-digit registration key
  112. ' sValidationCode     INPUT: App's validation code
  113. ' sYourName           INPUT: Your name (if registered)
  114. ' nYourKey            INPUT: Your key (if registered)
  115. ' peRegistered        OUTPUT: Is key valid
  116.  
  117. DECLARE FUNCTION RegKeyValidate%(sRegString$, sRegKey$, sValidationCode$, sYourName$, nYourKey AS LONG, peRegistered AS INTEGER)
  118.  
  119.  
  120.  
  121. ' RegFileKeyGenerate()
  122. '
  123. ' Generates a file-based registration key for a particular user, using the
  124. ' secret generation code corresponding to a particular application (as
  125. ' passeed to RegKeyNewCodeSet()). The registration string is usually the
  126. ' name of the registered user, but may also contain other information, such
  127. ' as the version registered or date of expiry. A registration key file is
  128. ' generated, using the specified filename, containing the registration string
  129. ' and the resulting registration key. If a file with the specified name
  130. ' already exists, it is overwritten. sRandomSeed should contain 10 random
  131. ' numbers and upper-case letters, which are required during the registration
  132. ' key generation process.
  133. '
  134. ' This function is called by KeyGen or your own registration key generation
  135. ' utility, each time a registration key is generated for a new user. This
  136. ' function is used for file-based registration keys; compare with
  137. ' RegKeyGenerate().
  138. '
  139. ' sRegString         INPUT: Registration string
  140. ' sGenerationCode    INPUT: App's generation code
  141. ' sRandomSeed        INPUT: Random number seed
  142. ' sFileName          INPUT: Registration key file name
  143.  
  144. DECLARE FUNCTION RegKeyFileGenerate%(sRegString$, sGenerationCode$, sRandomSeed$, sFileName$)
  145.  
  146.  
  147.  
  148. ' RegKeyFileValidate()
  149. '
  150. ' Checks whether the specified registration key file is valid for a
  151. ' particular application, using the application-specified validation code
  152. ' that was generated by RegKeyNewCodeSet(). The RKVALID pointed to by
  153. ' peRegistered is set to either RK_REGISTERED or RK_UNREGISTERED,
  154. ' indicating whether or not the registration key and registration string
  155. ' stored in the registration key file are valid. The sFileName parameter
  156. ' may include wildcards. If you have registered RegKey, your own name and
  157. ' RegKey registration key should be passed to this function to diable the
  158. ' RegKey "unregistered" message.
  159. '
  160. ' This function is called from within your application each time it
  161. ' executes, in order to determine whether it should operate in registered
  162. ' or unregistered mode. This function is used with file-based registration
  163. ' keys; compare with RegKeyValidate().
  164. '
  165. ' sFileName           INPUT: Registration key file name
  166. ' sValidationCode     INPUT: App's validation code
  167. ' sYourName           INPUT: Your name (if registered)
  168. ' nYourKey            INPUT: Your key (if registered)
  169. ' sRegString          OUTPUT: Registration string
  170. ' cbMaxStringSize     INPUT: Characters in reg. string
  171. ' peRegistered        OUTPUT: Is key valid
  172.  
  173. DECLARE FUNCTION RegKeyFileValidate%(sFileName$, sValidationCode$, sYourName$, nYourKey AS LONG, sRegString$, cbMaxStringSize AS INTEGER, peRegistered AS INTEGER)
  174.